const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

module.exports = {
  formatTime
}

function getUserProfile() {
  wx.getUserProfile({
    desc: '用于完善个人资料',
    success: function(res) {
      var userInfo = res.userInfo
      // console.log('userInfo==>', userInfo)
      wx.setStorageSync('storage_info', 1);//本地标记
      //下面将userInfo存入服务器中的用户个人资料
      
    },
    fail() {
      console.log("用户拒绝授权")
    }
  })
}